package com.jeesite.modules.billnorecord.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 单据编码记录表Entity
 * @author 码脑洞
 * @version 2025-04-13
 */
@Table(name="t_bill_no_record", alias="a", label="单据编码记录表信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="pattern_id", attrName="patternId", label="单号格式ID"),
		@Column(name="seq", attrName="seq", label="序号"),
		@Column(name="code", attrName="code", label="单号"),
		@Column(name="serial", attrName="serial", label="序列号"),
	}, orderBy="a.auto_id DESC"
)
public class BillNoRecord extends DataEntity<BillNoRecord> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private Long patternId;		// 单号格式ID
	private Integer seq;		// 序号
	private String code;		// 单号
	private String serial;		// 序列号

	public BillNoRecord() {
		this(null);
	}
	
	public BillNoRecord(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotNull(message="单号格式ID不能为空")
	public Long getPatternId() {
		return patternId;
	}

	public void setPatternId(Long patternId) {
		this.patternId = patternId;
	}
	
	@NotNull(message="序号不能为空")
	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}
	
	@NotBlank(message="单号不能为空")
	@Size(min=0, max=100, message="单号长度不能超过 100 个字符")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@NotBlank(message="序列号不能为空")
	@Size(min=0, max=10, message="序列号长度不能超过 10 个字符")
	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}
	
}